package com.example.designModel.buid.process;

import javax.swing.*;
import java.awt.*;
import java.awt.geom.Rectangle2D;

public class Main extends JFrame {

    public static void main(String[] args) {
        new Main();
    }
    public  Main(){
        setBounds(500,300,800,800);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
        MyCanvas myCanvas = new MyCanvas();
        add(myCanvas);
    }
    private class MyCanvas extends Canvas{ //Canvas类，是画布，我们没有纸，只有笔，也没办法画
        @Override
        public void paint(Graphics g) {
            Graphics2D g2d = (Graphics2D)g;
            g2d.setColor(Color.black);
            Shape shape = new Rectangle2D.Double(110,5,100,100);
            PersonThinBuilder personThinBuilder = new PersonThinBuilder(g2d, shape);
            PersonDirector director = new PersonDirector(personThinBuilder);
            director.createPerson();

            PersonFatBuilder fatBuilder = new PersonFatBuilder(g2d, shape);
            PersonDirector directorfat = new PersonDirector(fatBuilder);
            directorfat.createPerson();

        }
    }
}
